package tanke;

import java.util.Vector;

/**
 * 坦克位置
 *
 * @author bao
 *
 */

public class Tank {
	private int x;
	private int y;
	private int direct = 1; // 方向 有1上、2下、3左、4右
	private int type = 1; // 坦克类型 0、1 敌、我
	private int speed = 3;
	int enemySpeed = 2;
	private boolean isLive = true;

	/**
	 *
	 * @param x
	 * @param y
	 * @param direct
	 *            方向 有1上、2下、3左、4右
	 * @param type
	 *            坦克类型 0、1 敌、我
	 * @param speed
	 */
	public Tank(int x, int y, int direct, int type, int speed) {
		super();
		this.x = x;
		this.y = y;
		this.direct = direct;
		this.type = type;
		this.speed = speed;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getDirect() {
		return direct;
	}

	public void setDirect(int direct) {
		this.direct = direct;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getSpeed() {
		return speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}

	public boolean isLive() {
		return isLive;
	}

	public void setLive(boolean isLive) {
		this.isLive = isLive;
	}

	public void moveUp() {
		this.setY(y -= speed);
		this.setDirect(1);
	}

	public void moveDown() {
		this.setY(y += speed);
		this.setDirect(2);
	}

	public void moveLeft() {
		this.setX(x -= speed);
		this.setDirect(3);
	}

	public void moveRight() {
		this.setX(x += speed);
		this.setDirect(4);
	}

}



